import { Form } from 'ant-design-vue'
import { ref } from 'vue'

const { useForm } = Form

export function useDictDataForm() {
  const show = ref(false)
  const loading = ref(false)
  const formModel = ref({
    dictType: '',
    dictLabel: '',
    dictValue: '',
    dictSort: 0,
    status: '0',
    remark: ''
  } as ICreateDictDataDTO)
  const formRules = ref({
    dictLabel: [{ required: true, message: '请输入数据标签' }],
    dictValue: [{ required: true, message: '请输入数据键值' }]
  } as FormRules<ICreateDictDataDTO>)

  const formRef = useForm(formModel, formRules)

  return {
    show,
    loading,
    formRef,
    formModel
  }
}
